<?php

namespace app\common\validate\xiluhouse;

use think\Validate;

class UserAuth extends Validate
{
    /**
     * 验证规则
     */
    protected $rule = [
        'username|姓名'        => ['require'],
        'mobile|手机号'        => ['require','length:11'],
        'identify|身份证'      => ['require'],
        'id_face|人脸面'       => ['require'],
        'id_back|国徽面'       => ['require'],
        'is_broker|申请角色'    => ['in:1,2'],
    ];
    /**
     * 提示消息
     */
    protected $message = [
    ];
    /**
     * 验证场景
     */
    protected $scene = [
        'add'  => [],
        'edit' => [],
    ];

    protected function village_valid($value, $rule, $data) {
        if($value == 1){
            if(empty($data['house_certification'])){
                return '请上传房产证';
            }
        }
        return true;
    }
}
